﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using University.Workshop.Presenters;
using University.Workshop.Model;
using University.Workshop.Presenters.MedicalSuppliesFolder;

namespace University.Workshop.WinApp
{
    public partial class UpdateMedicalSupplies : Form , IUpdateMedicalSupplies
    {
        int data;
        
        private Model.MedicalSupplies item;

        PresenterUpdateMedicalSupplies presenter;
   

        public UpdateMedicalSupplies(Model.MedicalSupplies item)
        {
            data = 1;
            InitializeComponent();
            this.item = item;
            presenter = new PresenterUpdateMedicalSupplies(this);
       
        }

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (Char.IsNumber(e.KeyChar))
            {
                e.Handled = false;
            }
            else if (Char.IsControl(e.KeyChar))
            {
                e.Handled = false;
            }
         //   else if (Char.IsSeparator(e.KeyChar))
        //    {
        //        e.Handled = false;
        //    }
            else
            {
                e.Handled = true;
            }
        }

        private void UpdateMedicalSupplies_Load(object sender, EventArgs e)
        {
            label2.Text = data.ToString();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MedicalSupplies item = new MedicalSupplies();
            item.QuantityAvailable = item.QuantityAvailable - int.Parse(textBox1.Text);
            presenter.UpdateMedicalSupplies();
            
        }



        #region Miembros de IUpdateMedicalSupplies

        MedicalSupplies IUpdateMedicalSupplies.Item
        {
            get
            {
                return item;
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        #endregion
    }
}
